package org.asociacion.backend.persistence.entities;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

@Entity
@Table(name="tbl_state", schema="asociacion")
public class TblState {
	
	@Id
	@Column
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	@Column(nullable=false, length=50, unique=true)
	private String name;
	
	@OneToMany(fetch=FetchType.LAZY, mappedBy="tblState")
	@OrderBy("name")
	private Set<TblCity> setTblCity;
	
	{
		setTblCity = new HashSet<TblCity>();
	}
	
	public Integer getId() {
		return id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}

	public Set<TblCity> getSetTblCity() {
		return setTblCity;
	}

	public void setSetTblCity(Set<TblCity> setTblCity) {
		this.setTblCity = setTblCity;
	}

}
